home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Cosmo Software 1997 May
/
SGI Cosmo Software 1997 May.iso
/
dist6.2
/
netscape.idb
/
usr
/
local
/
lib
/
netscape
/
copy_conditional.z
/
copy_conditional
Wrap
Text File
|
1997-05-23
|
875b
|
38 lines
#!/bin/sh
#
# this script copies the old name to the destination directory using
# the new name - if and only if the file doesn't already exist
# verify that we got all the arguments
DEST_DIR=$1
if [ "$DEST_DIR" = "" ] ; then
echo "Usage: $0 dest-dir src-name dest-name";
exit;
fi
SRC=$2
if [ "$SRC" = "" ] ; then
echo "Usage: $0 dest-dir src-name dest-name";
exit;
fi
DEST=$3
if [ "$DEST" = "" ] ; then
echo "Usage: $0 dest-dir src-name dest-name";
exit;
fi
# check whether the destination directory and file already exist
# if so, then we simply exit - our work is already done
if [ -f $DEST_DIR/$DEST ] ; then
exit;
fi
# so destination doesn't exist - let's make sure the destination
# directory exists - if not make it
if [ ! -d $DEST_DIR ] ; then
mkdir -p $DEST_DIR
fi
# so copy the file to the new location giving it a new name
cp $SRC $DEST_DIR/$DEST
exit